package com.bwie.config;

import com.bwie.utils.R;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @description : TODO
 * @Author QiHainan
 * @Create 2025/7/21 21:28
 * @Version 1.0
 */
@Configuration
public class MyThreadPool {
//    @Bean
//    public ThreadPoolExecutor readyThreadPool(){
//        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
//                8,
//                16,
//                0L, TimeUnit.MILLISECONDS,
//                new LinkedBlockingQueue<Runnable>(),
//                Executors.defaultThreadFactory());
//
//        return threadPoolExecutor;
//    }
    @Bean
    public ThreadPoolExecutor readyThreadPool(){
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(8, 16,
                0L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>(),
                Executors.defaultThreadFactory());
        return threadPoolExecutor;
    }
}
